package com.anlu.pattern.structrue.decorator;

import com.anlu.pattern.create.factory.abstractFactory.AbstractFactory;
import com.anlu.pattern.create.factory.abstractFactory.AppleFactory;
import com.anlu.pattern.common.entity.Bag;
import com.anlu.pattern.common.entity.Fruit;

public class DecoratorClient {
    public static void main(String[] args) {
        sendFruit();
    }

    /**
     * 发送水果
     */
    public static  void sendFruit(){
        AbstractFactory factory = new AppleFactory();
        //得到水果
        Fruit fruit=factory.getFruit();
        fruit.draw();

        //得到包装
        Bag bag = factory.getBag();
        //现在要增加防伪标识
        bag = new CheckedBagDecorator(bag);
        //加固包装
        bag = new ReinforceBagDecorator(bag);
        //加急标识
        bag = new SpeedDecorator(bag);

        bag.pack();


    }
}
